package com.atguigu.r2dbc.controller;

import com.atguigu.r2dbc.entity.TAuthor;
import com.atguigu.r2dbc.repositories.AuthorRepositories;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @author lfy
 * @Description
 * @create 2023-12-23 20:58
 */

@RestController
public class AuthorController {
    private static final Logger logger = LoggerFactory.getLogger(AuthorController.class);

    private final AuthorRepositories repository;

    public AuthorController(AuthorRepositories repository) {
        this.repository = repository;
    }

    @GetMapping("/authors")
    public Flux<TAuthor> getAllAuthor() {
        return repository.findAll();
    }
}
